package com.mp.ipm2020.admin.config;

import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.mp.ipm2020.admin.handler.MyMetaObjectHandler;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @Auther adidasshe@mp.cn
 * <p>
 * MyBatis-plus配置类 (mapper及service的位置)
 */
@Configuration
@EnableTransactionManagement
@ComponentScan({"com.mp.ipm2020.mbg",}) //扫描service
@MapperScan({"com.mp.ipm2020.mbg.mapper", "com.mp.ipm2020.mbg.dao"}) //扫描mapper
public class MyBatisConfig {
    /**
     * 自动填充功能
     *
     * @return
     */
    @Bean
    public GlobalConfig globalConfig() {
        GlobalConfig globalConfig = new GlobalConfig();
        globalConfig.setMetaObjectHandler(new MyMetaObjectHandler());
        return globalConfig;
    }


}
